#include "EController.h"
#include "DefineCommon.h"
#include "EItemMetaProperty.h"
#include <cstddef>
//#include <asm-generic/errno.h>
//#include <cstddef>
//#include <iterator>


EController::EController()
{
    m_rootEItem = NewSmartPtr(EItem)();
}

EController::~EController()
{
}
    
long EController::getTag()
{
    return (long)this;
}

void EController::setRootItem(EItemPtr item)
{
    this->m_rootEItem = item;
}

void EController::refresh()
{
    this->travelEItem(this->m_rootEItem);
}

bool EController::handleEItem(EItemPtr item, int depth, EItemPtr parentItem)
{
    return true;
}

EItemPtr EController::getSelectedItem()
{
    return nullptr;
}

void EController::addItem(EItemPtr parent, EItemPtr child)
{
}

void EController::selectItem(EItemPtr item)
{
}

void EController::handleCommand(const ECommandPtr& command)
{
}

void EController::addCmdSenderList(long p)
{
    this->m_cmdSenderList.push_back(p);
}

bool EController::ifCmdSenderValid(long p)
{
    bool result=false;
    for(size_t i = 0; i < this->m_cmdSenderList.size(); i++)
    {
        if (p == this->m_cmdSenderList[i]) 
        {
        result=true;
        break;
        }
    }
    return result;
}
